//
//  XRWeakSelfOrderSectionTableCell.m
//  XClassRoom
//
//  Created by CoderYee on 16/11/7.
//  Copyright © 2016年 CoderYee. All rights reserved.
//

#import "XRWeakSelfOrderSectionTableCell.h"

@implementation XRWeakSelfOrderSectionTableCell

-(void)addOwnView
{
    [super addOwnView];
    
    
    
    NSArray *titleArray=@[@"待付款",@"待发货",@"待收货",@"待评价",@"退款售后",@"我的订单"];
    CGFloat buttonWith=kMainScreenWidth/6.0;
    for (NSInteger OrderSectionindex=0; OrderSectionindex<6; OrderSectionindex++)
    {
        UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
        [button setFrame:CGRectMake(buttonWith*OrderSectionindex, 0, buttonWith, 46)];
        [button setTitle:titleArray[OrderSectionindex] forState:UIControlStateNormal];
        button .titleLabel.font=[UIFont Y_systemFontOfSize:IPhone4_5_6_6P(13, 13, 14, 14)];
        button.titleLabel.textAlignment=NSTextAlignmentCenter;
        button.tag=1000+OrderSectionindex;
        [button setTitleColor:kBlackColor forState:UIControlStateNormal];
        [button addTarget:self action:@selector(clickButton:) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:button];
        if (OrderSectionindex!=5)
        {
         UIView *lineView=[[UIView alloc] initWithFrame:CGRectMake(buttonWith*(OrderSectionindex+1), 12, 1, 22)];
            lineView.alpha=0.5;
            [lineView setBackgroundColor:kGrayColor];
            [self.contentView addSubview:lineView];
        }
       
    }
    
}
-(void)clickButton:(UIButton *)sender
{
    if (self.delegate&&[self.delegate respondsToSelector:@selector(clickButtoninXRWeakSelfOrderSectionTableCellatIndex:)])
    {
        [self.delegate clickButtoninXRWeakSelfOrderSectionTableCellatIndex:sender.tag-1000];
    }
    
}

@end
